package com.server.config.http_interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class Support extends WebMvcConfigurationSupport {

    /**
     * 注入需要的拦截器类
     */
    @Autowired
    OverallInterceptor overallInterceptor;

    /**
     * 配置拦截器
     * @param registry 默认传入
     */
    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        // 参数/**标识所有请求都拦截
        registry.addInterceptor(overallInterceptor).addPathPatterns("/**");
    }
}
